﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LibarayMS
{
    public partial class Frm_main : Form
    {
        public event myDelegate logoutEvent;
        private string mname,mid;
        public Frm_main(string mname,string mid)
        {
            this.mname = mname;
            this.mid = mid;
            InitializeComponent();
        }
        //public Frm_main()
        //{
        //    InitializeComponent();
        //}

        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Frm_reader_manage frm = new Frm_reader_manage(mname);
            frm.returnEvent += new myDelegate(Frm_returnEvent);
            frm.logoutEvent += new myDelegate(Frm_logoutEvent);
            frm.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            Frm_pub_manage frm = new Frm_pub_manage(mname);
            frm.returnEvent += new myDelegate(Frm_returnEvent);
            frm.logoutEvent += new myDelegate(Frm_logoutEvent);
            frm.Show();
        }

        private void Frm_returnEvent()
        {
            this.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Hide();
            Frm_book_info frm = new Frm_book_info(mname);
            frm.returnEvent += new myDelegate(Frm_returnEvent);
            frm.logoutEvent += new myDelegate(Frm_logoutEvent);
            frm.Show();
        }

        private void Frm_logoutEvent()
        {
            logoutEvent();
            this.Close();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Hide();
            Frm_store_info frm = new Frm_store_info(mname);
            frm.returnEvent += new myDelegate(Frm_returnEvent);
            frm.logoutEvent += new myDelegate(Frm_logoutEvent);
            frm.Show();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            this.Hide();
            Frm_borrow_manage frm = new Frm_borrow_manage(mname,mid);
            frm.returnEvent += new myDelegate(Frm_returnEvent);
            frm.logoutEvent += new myDelegate(Frm_logoutEvent);
            frm.Show();
        }


        private void button6_Click(object sender, EventArgs e)
        {
            this.Hide();
            Frm_return_manage frm = new Frm_return_manage(mname,mid) ;
            frm.returnEvent += new myDelegate(Frm_returnEvent);
            frm.logoutEvent += new myDelegate(Frm_logoutEvent);
            frm.Show();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            this.Hide();
            Frm_fine_manage frm = new Frm_fine_manage(mname,mid);
            frm.returnEvent += new myDelegate(Frm_returnEvent);
            frm.logoutEvent += new myDelegate(Frm_logoutEvent);
            frm.Show();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            logoutEvent();
            this.Close();
        }

        private void Frm_main_Load(object sender, EventArgs e)
        {
            lbl_mname.Text = mname;
        }
    }
}
